package com.sgb.kjwl.view.ui.adapter.self.order;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.ChangeOrderPeopleEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.StringUtil;

import java.util.List;

public class ChangeOrderPeopleAdapter extends BaseRecycleAdapter<ChangeOrderPeopleEntity.ListBean> {

    private Context context;
    private TextView tvCompany;
    private ImageView ivSelecte;
    private TextView tvTime;
    private TextView tvPrice;
    private TextView tvStatus;
    private TextView tvPeople;

    public ChangeOrderPeopleAdapter(Context context, List<ChangeOrderPeopleEntity.ListBean> datas) {
        super(context, R.layout.item_change_order_people, datas);
        this.context = context;
    }

    @Override
    public void convert(ItemViewHolder holder, final ChangeOrderPeopleEntity.ListBean entity) {
        holder.setBinding(BR.viewModel, entity);
        tvCompany = holder.getItem().findViewById(R.id.tv_company);
        ivSelecte = holder.getItem().findViewById(R.id.iv_selecte);
        tvTime = holder.getItem().findViewById(R.id.tv_time);
        tvPrice = holder.getItem().findViewById(R.id.tv_price);
        tvStatus = holder.getItem().findViewById(R.id.tv_status);
        tvPeople = holder.getItem().findViewById(R.id.tv_people);

        tvCompany.setText(entity.getCompany());
        tvStatus.setText(entity.getStatus());
        tvPeople.setText(entity.getOrderPeople());
        tvTime.setText(entity.getTime());
        tvPrice.setText("￥"+ StringUtil.showPrice(entity.getPrice()));

        if (entity.isSelect()){
            ivSelecte.setBackground(context.getResources().getDrawable(R.drawable.icon_selected_change_people));
        }else {
            ivSelecte.setBackground(context.getResources().getDrawable(R.drawable.icon_unselect_change_people));
        }
    }

   /* private CheckOrderListAdapter.onEditClickListener editClickListener;

    public void setonEditClick(CheckOrderListAdapter.onEditClickListener editClickListener) {
        this.editClickListener = editClickListener;
    }

    public interface onEditClickListener {
        void onCancelClick(String id, int position);
        void onUpClick(String id, int position);
        void onEditeClick(String id, int position);
    }*/
}
